# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ChromeUXReport.V1.Model.Record do
  @moduledoc """
  Record is a single Chrome UX report data record. It contains use experience statistics for a single url pattern and set of dimensions.

  ## Attributes

  *   `collectionPeriod` (*type:* `GoogleApi.ChromeUXReport.V1.Model.CollectionPeriod.t`, *default:* `nil`) - The collection period indicates when the data reflected in this record was collected.
  *   `key` (*type:* `GoogleApi.ChromeUXReport.V1.Model.Key.t`, *default:* `nil`) - Key defines all of the unique querying parameters needed to look up a user experience record.
  *   `metrics` (*type:* `%{optional(String.t) => GoogleApi.ChromeUXReport.V1.Model.Metric.t}`, *default:* `nil`) - Metrics is the map of user experience data available for the record defined in the key field. Metrics are keyed on the metric name. Allowed key values: ["first_contentful_paint", "first_input_delay", "largest_contentful_paint", "cumulative_layout_shift", "experimental_time_to_first_byte", "experimental_interaction_to_next_paint"]
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :collectionPeriod => GoogleApi.ChromeUXReport.V1.Model.CollectionPeriod.t() | nil,
          :key => GoogleApi.ChromeUXReport.V1.Model.Key.t() | nil,
          :metrics =>
            %{optional(String.t()) => GoogleApi.ChromeUXReport.V1.Model.Metric.t()} | nil
        }

  field(:collectionPeriod, as: GoogleApi.ChromeUXReport.V1.Model.CollectionPeriod)
  field(:key, as: GoogleApi.ChromeUXReport.V1.Model.Key)
  field(:metrics, as: GoogleApi.ChromeUXReport.V1.Model.Metric, type: :map)
end

defimpl Poison.Decoder, for: GoogleApi.ChromeUXReport.V1.Model.Record do
  def decode(value, options) do
    GoogleApi.ChromeUXReport.V1.Model.Record.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ChromeUXReport.V1.Model.Record do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
